<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String p7bcert = (String) request.getAttribute("p7bcert");
%>
<OBJECT classid="clsid:43F8F289-7A20-11D0-8F06-00C04FC295E1"
	id=EnrollOld>
</OBJECT>
<OBJECT classid="clsid:127698e4-e730-4e5c-a2b1-21490a70c8a1"
	id=EnrollNew>
</OBJECT>
<script language=vbs>
	Dim Enroll
	Dim downMsg
	pkcs7= "<%=p7bcert%>"
	On Error Resume Next
	Err.clear
	Set Enroll = EnrollNew
	if(0 = len(Enroll.enumProviders(0,0))) Then
		Set Enroll = EnrollOld
	end if	
	Enroll.WriteCertToCSP = true
	Enroll.acceptPKCS7(pkcs7)
	If Err.number <> 0 then
		msgbox "write to csp failed"
		Enroll.WriteCertToCSP = false
	End If
	Err.clear
	Enroll.acceptPKCS7(pkcs7)
	If Err.number <> 0 Then
		downMsg = "证书下载发生错误"
		errcode = hex(Err.Number)
		if err.number = &H800704C7 then
              'MsgBox "The error: " + hex(err.number) + " 在证书安装过程中产生，其原因可能是安装证书时弹出的提示框您选择了“否”！",0,"证书安装失败提示"
              Err.Clear    '清除错误
              window.navigate ("<%=request.getContextPath()%>/common/CertInstallErr.jsp?flag=800704C7")
              'Exit Sub
          elseif  err.number = &H80090020 then
              'MsgBox "The error: " + hex(err.number) + " 在证书安装过程中产生，其原因可能是您选择的证书存储介质空间已满，或您没有正确插入您所使用的证书存储介质！",0,"证书安装失败提示"
              Err.Clear    '清除错误
              window.navigate ("<%=request.getContextPath()%>/common/CertInstallErr.jsp?flag=80090020")
              'Exit Sub
		 elseif  err.number = &H800B0109 then
              'MsgBox "The error: " + hex(err.number) + " 在证书安装过程中产生，其原因可能是您的机器中没有安装建行的根证书，请下载安装建行根证书！",0,"证书安装失败提示"
              Err.Clear    '清除错误
              window.navigate ("<%=request.getContextPath()%>/common/CertInstallErr.jsp?flag=800B0109")
              'Exit Sub
 		 elseif  err.number = &H800B0101 then
              'MsgBox "The error: " + hex(err.number) + " 其原因可能是您的机器中时间设置不正确,请调整您的系统时间！",0,"证书安装失败提示"
              Err.Clear    '清除错误
              window.navigate ("<%=request.getContextPath()%>/common/CertInstallErr.jsp?flag=800B0101")
              'Exit Sub
          else
              'MsgBox "The error: " + hex(err.number) + " 在证书安装过程中产生，其原因可能是您选择的证书存储介质空间已满，或您没有正确插入您所使用的证书存储介质！",0,"证书安装失败提示"
              Err.Clear    '清除错误
              window.navigate ("<%=request.getContextPath()%>/common/CertInstallErr.jsp?flag=8010000C&ErrorNum="&errnum)
              'Exit Sub
          end if



	ELSE
		downMsg = "证书下载成功"
	End If
</script>
<html:html>
<head>
	<title></title>
	<link href="<%=request.getContextPath()%>/css/style.css"
		rel="stylesheet" type="text/css" media="all">
</head>
<body>
	<br>
	<br>
	<br>
	<br>
	<br>
	<table width='322' border='0' cellspacing='0' cellpadding='0'
		align='center'>
		<tr>
			<td>
				<img src='<%=request.getContextPath()%>/images/pic_notice_top.jpg'
					width='322' height='13'>
			</td>
		</tr>
		<tr>
			<td
				background='<%=request.getContextPath()%>/images/pic_notice_bg.jpg'
				height='100'>
				<div align='center'>
					<table width='250' border='0' cellspacing='2' cellpadding='0'>
						<tr>
							<td class='' valign=middle>
								<table>
									<tr>
										<td>
											<img src='<%=request.getContextPath()%>/images/succse.gif'
												width='26' height='26'>
										</td>
										<td>
											成功
										</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td>
								&nbsp;
							</td>
						</tr>
						<tr>
							<td class='txt'>
								证书下载成功
							</td>
						</tr>
						<tr>
							<td>
								&nbsp;
							</td>
						</tr>
					</table>
				</div>
			</td>
		</tr>
		<tr>
			<td>
				<img
					src='<%=request.getContextPath()%>/images/pic_notice_bottom.jpg'
					width='322' height='12'>
			</td>
		</tr>
	</table>
</body>
</html:html>